home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / Macintosh Sample Code / SC.014.CPlusTESample / TEDocument.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-18  |  2.3 KB  |  91 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------------------
  2.  
  3.     Program:    CPlusTESample 2.0
  4.     File:        TEDocument.h
  5.     Uses:       Document.h
  6.  
  7.     by Andrew Shebanow
  8.     of Apple Macintosh Developer Technical Support
  9.  
  10.     Copyright © 1989-1990 Apple Computer, Inc.
  11.     All rights reserved.
  12.  
  13. ------------------------------------------------------------------------------------------*/
  14.  
  15. #ifndef __TEDOCUMENT__
  16. #define __TEDOCUMENT__
  17.  
  18. #ifndef __TYPES__
  19. #include <Types.h>
  20. #endif
  21. #ifndef __TEXTEDIT__
  22. #include <TextEdit.h>
  23. #endif
  24. #ifndef __CONTROLS__
  25. #include <Controls.h>
  26. #endif
  27. #ifndef __EVENTS__
  28. #include <Events.h>
  29. #endif
  30.  
  31. #ifndef __DOCUMENT__
  32. #include "Document.h"
  33. #endif
  34.  
  35. // kTEFileType is the type of our files - in this case, TEXT
  36. const OSType kTEFileType = 'TEXT';
  37.  
  38. class TEDocument : public TDocument {
  39. private:
  40.     TEHandle        fDocTE;            // our text
  41.     ControlHandle    fDocVScroll;    // vertical scrollbar
  42.     ControlHandle    fDocHScroll;    // horizontal scrollbar
  43.     TEClickLoopUPP    fDocClick;        // our click loop
  44.  
  45.     // methods not intended for use outside of this class
  46.     // They aren't virtual since private routines can
  47.     // never be overridden, and non-virtual calls are
  48.     // faster than virtual calls.
  49.             void    GetTERect(Rect* teRect);
  50.             void    AdjustTE();
  51.             void    DrawWindow();
  52.             void    AdjustViewRect();
  53.             void    ResizeWindow();
  54.             void    AdjustHV(Boolean isVert,Boolean mustRedraw);
  55.             void    AdjustScrollSizes();
  56.             void    AdjustScrollbars(Boolean needsResize);
  57.  
  58. protected:
  59.     // i/o routines
  60.     virtual void    ReadFromFile(short refNum);
  61.     virtual void    WriteToFile(short refNum);
  62.  
  63. public:
  64.                     TEDocument(short resID);
  65.     virtual            ~TEDocument();
  66.  
  67.     // methods from TDocument we override
  68.     virtual void    DoZoom(short partCode);
  69.     virtual void    DoGrow(EventRecord* theEvent);
  70.     virtual void    DoContent(EventRecord* theEvent);
  71.     virtual void    DoKeyDown(EventRecord* theEvent);
  72.     virtual void    DoActivate(Boolean becomingActive);
  73.     virtual void    DoIdle();
  74.     virtual void    DoUpdate();
  75.     virtual void    DoCut();
  76.     virtual void    DoCopy();
  77.     virtual void    DoPaste();
  78.     virtual void    DoClear();
  79.     virtual unsigned long CalcIdle();
  80.     virtual Boolean    HaveSelection();
  81.     virtual void    DoSelectAll();
  82.  
  83.     // new public methods
  84.     void            AdjustScrollValues(Boolean mustRedraw);
  85.     TEClickLoopUPP  GetClickLoop();
  86.     TEHandle        GetTEHandle();
  87.     void            GetVisTERgn(RgnHandle rgn);
  88. };
  89.  
  90. #endif
  91.